import { mapGetters, mapActions } from "vuex"
export const mixins = {
    props: ["imageryIndex"],
    computed: {
        //意象属性 在创作模块显示创作对应的意向
        imageryStyle() {
            return {
                position: "absolute",
                background: "url(" + this.imageryIndex.eryImg + ") 0 0/100% 100%",
                width: this.imageryIndex.width,
                height: this.imageryIndex.height,
                left: this.imageryIndex.left,
                top: this.imageryIndex.top,
                zIndex: this.imageryIndex.isFront ? 99 : 98
            }
        },
        ...mapGetters("picbookListStatus", {
            picbookIndex: "getPicbookIndex"
        }),
        ...mapGetters("personalStatus", {
            userCollect: "getUserCollect"
        })
    },
    methods: {
        //意象点击
        imageryTouch: function () {
            //在旁白中显示意象名
            this.setWordImagery(this.imageryIndex.explain)
            this.clickMusic()
            //暂停旁白
            this.parseTextAudio({
                play: false
            })
            //显示卡片
            this.setPackCard({
                type: "imagery",
                icon: this.imageryIndex.icon,
                content: this.imageryIndex
            })
            //记录意象
            this.imageryIndex.picbookId = this.picbookIndex.id
            this.insertImageryCollect(this.imageryIndex)
            this.userSaveDate("userCollect", this.userCollect)
        },
        ...mapActions("wordStatus", ["setWordImagery"]),
        ...mapActions("packStatus", ["setPackCard"]),
        ...mapActions("personalStatus", ["insertImageryCollect"])
    }
}